package com.wk.wkcomp

import com.blankj.utilcode.util.ToastUtils
import com.wk.lib_base.view.BaseActivity
import com.wk.wkcomp.mainpage.MainPageFragment
import com.wk.wkcomp.me.MeFragment
import kotlinx.android.synthetic.main.activity_container.*

class ContainerActivity : BaseActivity() {
    override fun initViews() {
        val mainPageFragment = MainPageFragment()
        val meFragment = MeFragment()
        supportFragmentManager.beginTransaction().add(R.id.fragmentLayout, mainPageFragment, "main")
            .commit()
        supportFragmentManager.beginTransaction().add(R.id.fragmentLayout, meFragment, "me")
            .commit()
        supportFragmentManager.beginTransaction().hide(meFragment).commit()

        tv_tab_mainPage.setOnClickListener {
            ToastUtils.showShort("点了首页")
            supportFragmentManager.beginTransaction().show(mainPageFragment).hide(meFragment)
                .commit()
        }
        tv_tab_me.setOnClickListener {
            ToastUtils.showShort("点了我")
            supportFragmentManager.beginTransaction().show(meFragment).hide(mainPageFragment)
                .commit()
        }

    }

    override fun getLayoutId(): Int = R.layout.activity_container
}